<?php
require_once 'config.php';
?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="style.css" />
    <title><?php echo $title; ?></title>
</head>

<body>
    
    <div class="biaoti"><?php echo $title; ?></div>
        <div class="aaa">
            <p class="button">
                <a href="xuyuan.php?id=<?php echo $row['id']; ?>"><button>我要许愿</button></a>
            </p>
            <ul>
                <?php
                // 最新留言展示前面
                $sql = "SELECT * FROM `wish` ORDER BY `wish`.`id` DESC";
                $result = $conn->query($sql);

                if ($result->num_rows > 0) {
                    // 输出数据
                    while ($row = $result->fetch_assoc()) {
                ?>
                        <li style="list-style: none; background:<?php echo $row['color'] ?>;">
                            <p><?php echo $row["name"]; ?></p>
                            <p><?php echo $row["content"]; ?></p>
                            <p><?php echo $row["time"]; ?></p>
                       <a href="edit.php?id=<?php echo $row["id"]; ?>">编辑</a>
                       <a href="del.php?id=<?php echo $row["id"]; ?>">删除</a>
                        </li>
                <?php
                    }
                }
                ?>
            </ul>
        </div>
</body>

</html>